<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link href="https://api.mapbox.com/mapbox-gl-js/v2.9.1/mapbox-gl.css" rel="stylesheet">
    <script src="https://api.mapbox.com/mapbox-gl-js/v2.9.1/mapbox-gl.js"></script>
    <script src='https://unpkg.com/@antv/l7'></script>
    <style>
        html,
        body {
            overflow: hidden;
            margin: 0;
        }

        #map {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 100%;
        }
    </style>
</head>

<body>
    <div id="map">

    </div>
    <script>
        mapboxgl.accessToken = 'pk.eyJ1IjoiY2hlbmdiZW5jaGFvIiwiYSI6ImNsODU3aGRiODA0Y2UzcHBzZmFlcmdqZ2sifQ.8k59W_pB_Riwe6o-MneRlA'
        const map = new mapboxgl.Map({
            container: 'map', // container id
            style: 'mapbox://styles/mapbox/streets-v12', // stylesheet location
            center: [114.30, 30.50],
            zoom: 10
        });
        // 地图放在外面，就可以拿到，直接new,放在里面，那就拿不到啦。
        const { Scene, Mapbox } = L7;
        const scene = new Scene({
            id: 'map',
            map: new Mapbox({
                mapInstance: map,
            }),
        });
        /* L7 */
        scene.on("loaded", () => {
            scene.on("click", (evt) => {
                console.log('点击了scenc',evt)
            })
        })
        map.on("click",evt=>{
            console.log('点击了map',evt)
        })
    </script>
</body>

</html>